<?php
/**
 * Html helper class.
 *
 * @package    Core / quangnghia
 * @author     Nguyen Quang Nghia @ ngaycuoithang2@gmail.com
 */
class NHtml {
	/**
	 * Return full relative path to image
	 * used for url rewrite
	 *
	 * @param string $src 
	 * @param string $alt 
	 * @param string $htmlOptions 
	 * @return void
	 * @author QuangNghia
	 */
	public static function image($src, $alt='',$htmlOptions = array()) {

	    return CHtml::image(bu($src),$alt,$htmlOptions);
	}	
	
	/**
	 * Load and initialize tiny mce for textarea
	 *
	 * @param string $config which config file should be used, default [min, normal, full]
	 * @return void
	 * @author QuangNghia
	 */
	public static function RegisterTinyMCE($config = 'normal')
	{
		cs()->registerCoreScript('jquery');

		cs()->registerScriptFile(bu().'/js/tinymce/core/tiny_mce.js');
		cs()->registerScriptFile(bu().'/js/tinymce/'.$config.'.config.js');
	}
	
	public static function RegisterFancyBox()
	{
		cs()->registerCoreScript('jquery');

		cs()->registerCssFile(bu().'/js/fancybox/jquery.fancybox-1.3.4.css');
		cs()->registerScriptFile(bu().'/js/fancybox/jquery.fancybox-1.3.4.pack.js');
		cs()->registerScriptFile(bu().'/js/fancybox/jquery.easing-1.3.pack.js');
		cs()->registerScriptFile(bu().'/js/fancybox/jquery.mousewheel-3.0.4.pack.js');
	}

	public static function icon($icon_class, $text = '', $img_title='', $type='img')
	{
		return '<img class="ss_sprite '.$icon_class.'" title="'.$img_title.'" style="vertical-align:middle"/>' . $text;
		// return '<span class="ss_sprite '.$icon_class.'">'.$text.'</span>';
	}

	public static function backLink($text=NULL)
	{
		if($text===NULL) $text = Yii::t('app','&larr; Về trang trước');
		return '<a href="javascript:history.go(-1)">'.$text.'</a>';
	}

	public static function themeImage($src, $alt='',$htmlOptions = array()) {
		return CHtml::image(themeBu($src),$alt,$htmlOptions);
	}
}